|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.neo4j.index.timeline.Timeline
public class Timeline
An implementation of TimelineIndex on top of Neo4j, using
BTree for indexing. Note: this implementation is not thread-safe
(yet).
Nodes added to a timeline will get a Relationship created to it so if
you delete such a node later on you'll have to remove it from the timeline
first (or in the same transaction at least).
| Constructor Summary | |
|---|---|
Timeline(String name,
org.neo4j.graphdb.Node underlyingNode,
boolean indexed,
org.neo4j.graphdb.GraphDatabaseService graphDb)
Creates/loads a timeline. |
|
Timeline(String name,
org.neo4j.graphdb.Node underlyingNode,
org.neo4j.graphdb.GraphDatabaseService graphDb)
Creates/loads an indexed timeline. |
|
| Method Summary | |
|---|---|
void |
addNode(org.neo4j.graphdb.Node nodeToAdd,
long timestamp)
Adds a node to this timeline with the given timestamp. |
void |
delete()
Deletes this timeline. |
Iterable<org.neo4j.graphdb.Node> |
getAllNodes()
Returns all added nodes in this timeline ordered by increasing timestamp. |
Iterable<org.neo4j.graphdb.Node> |
getAllNodes(Long afterTimestampOrNull,
Long beforeTimestampOrNull)
Convenience method which you can use TimelineIndex.getAllNodes(),
TimelineIndex.getAllNodesAfter(long), TimelineIndex.getAllNodesBefore(long) and
TimelineIndex.getAllNodesBetween(long, long) in a single method. |
Iterable<org.neo4j.graphdb.Node> |
getAllNodesAfter(long timestamp)
Returns all the nodes after (exclusive) timestamp ordered by
increasing timestamp. |
Iterable<org.neo4j.graphdb.Node> |
getAllNodesBefore(long timestamp)
Returns all the nodes before (exclusive) timestamp ordered by
increasing timestamp. |
Iterable<org.neo4j.graphdb.Node> |
getAllNodesBetween(long startTime,
long endTime)
Returns all the nodes after (exclusive) afterTimestamp and before
(exclusive) beforeTimestamp ordered by increasing timestamp. |
org.neo4j.graphdb.Node |
getFirstNode()
Returns the first node in the timeline, that is the node with the lowest timestamp or null if there's no nodes in the timeline. |
org.neo4j.graphdb.Node |
getLastNode()
Returns the last node in the timeline, that is the node with the highest timestamp or null if there's no nodes in the timeline. |
Iterable<org.neo4j.graphdb.Node> |
getNodes(long timestamp)
Returns nodes which were added with the given timestamp. |
long |
getTimestampForNode(org.neo4j.graphdb.Node node)
Will return the timestamp for node if it has been added to this
timeline. |
org.neo4j.graphdb.Node |
getUnderlyingNode()
Returns the underlying node representing this timeline. |
void |
removeNode(org.neo4j.graphdb.Node nodeToRemove)
Removes a node from the timeline. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Timeline(String name,
org.neo4j.graphdb.Node underlyingNode,
boolean indexed,
org.neo4j.graphdb.GraphDatabaseService graphDb)
underlyingNode can either be a
new (just created) node or a node that already represents a previously
timeline.
name - The unique name of the timeline or null if
timeline already existunderlyingNode - The underlying node representing the timelineindexed - Set to true if this timeline is indexedgraphDb - the GraphDatabaseService
public Timeline(String name,
org.neo4j.graphdb.Node underlyingNode,
org.neo4j.graphdb.GraphDatabaseService graphDb)
underlyingNode can
either be a new (just created) node or a node that already represents a
previously timeline.
name - The unique name of the timeline or null if
timeline already existunderlyingNode - The underlying node representing the timelinegraphDb - The GraphDatabaseService.| Method Detail |
|---|
public org.neo4j.graphdb.Node getUnderlyingNode()
public org.neo4j.graphdb.Node getLastNode()
TimelineIndexnull if there's no nodes in the timeline.
getLastNode in interface TimelineIndexnull if timeline is
empty.public org.neo4j.graphdb.Node getFirstNode()
TimelineIndexnull if there's no nodes in the timeline.
getFirstNode in interface TimelineIndexnull if timeline is
empty.
public void addNode(org.neo4j.graphdb.Node nodeToAdd,
long timestamp)
TimelineIndextimestamp.
addNode in interface TimelineIndexnodeToAdd - the node to add to this timeline.timestamp - the timestamp to usepublic long getTimestampForNode(org.neo4j.graphdb.Node node)
TimelineIndexnode if it has been added to this
timeline. If node hasn't been added to this timeline a runtime
exception will be thrown.
getTimestampForNode in interface TimelineIndexnode - the node to return the timestamp for.
node.public void removeNode(org.neo4j.graphdb.Node nodeToRemove)
TimelineIndexnodeToRemove isn't added in this timeline.
removeNode in interface TimelineIndexnodeToRemove - the node to remove from this timeline
public Iterable<org.neo4j.graphdb.Node> getAllNodes(Long afterTimestampOrNull,
Long beforeTimestampOrNull)
TimelineIndexTimelineIndex.getAllNodes(),
TimelineIndex.getAllNodesAfter(long), TimelineIndex.getAllNodesBefore(long) and
TimelineIndex.getAllNodesBetween(long, long) in a single method.
getAllNodes in interface TimelineIndexafterTimestampOrNull - the start timestamp, nodes with greater
timestamp value will be returned. Will be ignored if null.beforeTimestampOrNull - the end timestamp, nodes with lesser timestamp
value will be returned. Will be ignored if null.
startTimestampOrNull and/or endTimestampOrNull (where null means no restriction).public Iterable<org.neo4j.graphdb.Node> getAllNodes()
TimelineIndex
getAllNodes in interface TimelineIndexpublic Iterable<org.neo4j.graphdb.Node> getNodes(long timestamp)
TimelineIndextimestamp.
getNodes in interface TimelineIndextimestamp - the timestamp to get nodes for.
timestamp.public Iterable<org.neo4j.graphdb.Node> getAllNodesAfter(long timestamp)
TimelineIndextimestamp ordered by
increasing timestamp.
getAllNodesAfter in interface TimelineIndextimestamp - the timestamp value, nodes with greater timestamp value
will be returned.
timestamp ordered by
increasing timestamp.public Iterable<org.neo4j.graphdb.Node> getAllNodesBefore(long timestamp)
TimelineIndextimestamp ordered by
increasing timestamp.
getAllNodesBefore in interface TimelineIndextimestamp - the timestamp value, nodes with lesser timestamp value
will be returned.
timestamp ordered by
increasing timestamp.
public Iterable<org.neo4j.graphdb.Node> getAllNodesBetween(long startTime,
long endTime)
TimelineIndexafterTimestamp and before
(exclusive) beforeTimestamp ordered by increasing timestamp.
getAllNodesBetween in interface TimelineIndexstartTime - the start timestamp, nodes with greater timestamp
value will be returned.endTime - the end timestamp, nodes with lesser timestamp value
will be returned.
public void delete()
TimelineIndex
delete in interface TimelineIndex
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||